<template>
  <transition name="fade">
    <div class="dialog-mask">
      <div class="dialog-wrapper animated fadeInUp" ref="dialogWrapper">
        <div class="dialog-container">
          <div class="dialog-header">
            <h2>{{title}}</h2>
            <div class="close" @click='dialogClose'>x</div>
          </div>
          <div class="dialog-body">
            <slot></slot>
          </div>
          <div class="dialog-footer"></div>
        </div>
      </div>
    </div>
  </transition>
</template>
<script>
import "../../../static/css/animate.css";
export default {
  components: {},
  props: {
    title: {
      type: String,
      default: ""
    },
    cancel: {
      type: String,
      default: ""
    },
    confirm: {
      type: String,
      default: ""
    }
  },
  methods: {
    dialogClose() {
      this.$emit("close");
    }
  }
};
</script>
<style scoped lang="scss">
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.4s;
}
.fade-enter,
.fade-leave-active {
  opacity: 0;
}
.dialog-mask {
  background-color: rgba(0, 0, 0, 0.5);
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 1000;
  display: table;
  animation-duration: 0.6s;
  .dialog-wrapper {
    display: table-cell;
    vertical-align: middle;
    animation-duration: 0.3s;
    .dialog-container {
      margin: auto;
      top: 50%;
      width: 830px;
      background-color: white;
      border-radius: 12px;
      .dialog-header {
        height: 32px;
        border-radius: 12px 12px 0 0;
        border-bottom: 1px solid #cccccc;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 13px;
        h2 {
          color: #000;
        }
        .close {
          position: relative;
          right: -374px;
          font-size: 20px;
          cursor: pointer;
        }
      }
      .dialog-body {
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 20px 0;
      }
      .dialog-footer {
        height: 2px;
      }
    }
  }
}
</style>